package config;

import java.util.Properties;

public class Config {
	
	private Properties sourceDbTypes;
	private Properties targetDbTypes;
	
	private String sqlTplQueryTableNames;
	private String sqlTplQueryColumns;
	private String sqlTplQueryPkColumns;
	
	private String sqlTplCreateTable;
	private String sqlTplColumnDefine;
	private String sqlTplCreateComments;
	private String sqlTplCreatePk;
	private String sqlTplQueryIndex;
	private String sqlTplCreateIndex;
	private String sqlTplQuerySequences;
	private String sqlTplDropTable;
	
	public String getSqlTplDropTable() {
		return sqlTplDropTable;
	}
	public void setSqlTplDropTable(String sqlTplDropTable) {
		this.sqlTplDropTable = sqlTplDropTable;
	}
	public String getSqlTplQuerySequences() {
		return sqlTplQuerySequences;
	}
	public void setSqlTplQuerySequences(String sqlTplQuerySequences) {
		this.sqlTplQuerySequences = sqlTplQuerySequences;
	}
	public String getSqlTplQueryIndex() {
		return sqlTplQueryIndex;
	}
	public void setSqlTplQueryIndex(String sqlTplQueryIndex) {
		this.sqlTplQueryIndex = sqlTplQueryIndex;
	}
	public String getSqlTplCreateIndex() {
		return sqlTplCreateIndex;
	}
	public void setSqlTplCreateIndex(String sqlTplCreateIndex) {
		this.sqlTplCreateIndex = sqlTplCreateIndex;
	}
	public Properties getSourceDbTypes() {
		return sourceDbTypes;
	}
	public void setSourceDbTypes(Properties sourceDbTypes) {
		this.sourceDbTypes = sourceDbTypes;
	}
	public Properties getTargetDbTypes() {
		return targetDbTypes;
	}
	public void setTargetDbTypes(Properties targetDbTypes) {
		this.targetDbTypes = targetDbTypes;
	}
	public String getSqlTplQueryColumns() {
		return sqlTplQueryColumns;
	}
	public void setSqlTplQueryColumns(String sqlTplQueryColumns) {
		this.sqlTplQueryColumns = sqlTplQueryColumns;
	}
	public String getSqlTplQueryPkColumns() {
		return sqlTplQueryPkColumns;
	}
	public void setSqlTplQueryPkColumns(String sqlTplQueryPkColumns) {
		this.sqlTplQueryPkColumns = sqlTplQueryPkColumns;
	}
	public String getSqlTplCreateTable() {
		return sqlTplCreateTable;
	}
	public void setSqlTplCreateTable(String sqlTplCreateTable) {
		this.sqlTplCreateTable = sqlTplCreateTable;
	}
	public String getSqlTplColumnDefine() {
		return sqlTplColumnDefine;
	}
	public void setSqlTplColumnDefine(String sqlTplColumnDefine) {
		this.sqlTplColumnDefine = sqlTplColumnDefine;
	}
	public String getSqlTplCreateComments() {
		return sqlTplCreateComments;
	}
	public void setSqlTplCreateComments(String sqlTplCreateComments) {
		this.sqlTplCreateComments = sqlTplCreateComments;
	}
	public String getSqlTplCreatePk() {
		return sqlTplCreatePk;
	}
	public void setSqlTplCreatePk(String sqlTplCreatePk) {
		this.sqlTplCreatePk = sqlTplCreatePk;
	}
	public String getSqlTplQueryTableNames() {
		return sqlTplQueryTableNames;
	}
	public void setSqlTplQueryTableNames(String sqlTplQueryTableNames) {
		this.sqlTplQueryTableNames = sqlTplQueryTableNames;
	}
	
	public String getTargetDbType(String sourceDbType){
		if(this.getSourceDbTypes().containsKey(sourceDbType)){
			String midDbType = this.getSourceDbTypes().getProperty(sourceDbType);
			if(this.getTargetDbTypes().containsKey(midDbType)){
				String targetDbType = this.getTargetDbTypes().getProperty(midDbType);
				return targetDbType;
			}
		}
		
		throw new RuntimeException(String.format("%s暂不支持的数据类型", sourceDbType));
	}
}
